package com.example.everying.model.dto.pay;

import com.google.gson.annotations.SerializedName;
import com.wechat.pay.java.core.util.GsonUtil;
import com.wechat.pay.java.service.payments.model.PromotionDetail;
import com.wechat.pay.java.service.payments.model.Transaction;
import com.wechat.pay.java.service.payments.model.TransactionAmount;
import com.wechat.pay.java.service.payments.model.TransactionPayer;
import lombok.Data;
import lombok.Getter;

import java.util.List;

@Data
public class TransactionDto {
    @SerializedName("amount")
    private TransactionAmount amount;
    @SerializedName("appid")
    private String appid;
    @SerializedName("attach")
    private String attach;
    @SerializedName("bank_type")
    private String bankType;
    @SerializedName("mchid")
    private String mchid;
    @SerializedName("out_trade_no")
    private String outTradeNo;
    @SerializedName("payer")
    private TransactionPayer payer;
    @SerializedName("promotion_detail")
    private List<PromotionDetail> promotionDetail;
    @SerializedName("success_time")
    private String successTime;
    @SerializedName("trade_state")
    private Transaction.TradeStateEnum tradeState;
    @SerializedName("trade_state_desc")
    private String tradeStateDesc;
    @SerializedName("trade_type")
    private Transaction.TradeTypeEnum tradeType;
    @SerializedName("transaction_id")
    private String transactionId;
    public TransactionAmount getAmount() {
        return this.amount;
    }

    public void setAmount(TransactionAmount amount) {
        this.amount = amount;
    }

    public String getAppid() {
        return this.appid;
    }

    public void setAppid(String appid) {
        this.appid = appid;
    }

    public String getAttach() {
        return this.attach;
    }

    public void setAttach(String attach) {
        this.attach = attach;
    }

    public String getBankType() {
        return this.bankType;
    }

    public void setBankType(String bankType) {
        this.bankType = bankType;
    }

    public String getMchid() {
        return this.mchid;
    }

    public void setMchid(String mchid) {
        this.mchid = mchid;
    }

    public String getOutTradeNo() {
        return this.outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public TransactionPayer getPayer() {
        return this.payer;
    }

    public void setPayer(TransactionPayer payer) {
        this.payer = payer;
    }

    public List<PromotionDetail> getPromotionDetail() {
        return this.promotionDetail;
    }

    public void setPromotionDetail(List<PromotionDetail> promotionDetail) {
        this.promotionDetail = promotionDetail;
    }

    public String getSuccessTime() {
        return this.successTime;
    }

    public void setSuccessTime(String successTime) {
        this.successTime = successTime;
    }

    public Transaction.TradeStateEnum getTradeState() {
        return this.tradeState;
    }

    public void setTradeState(Transaction.TradeStateEnum tradeState) {
        this.tradeState = tradeState;
    }

    public String getTradeStateDesc() {
        return this.tradeStateDesc;
    }

    public void setTradeStateDesc(String tradeStateDesc) {
        this.tradeStateDesc = tradeStateDesc;
    }

    public Transaction.TradeTypeEnum getTradeType() {
        return this.tradeType;
    }

    public void setTradeType(Transaction.TradeTypeEnum tradeType) {
        this.tradeType = tradeType;
    }

    public String getTransactionId() {
        return this.transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String toString() {
        return GsonUtil.getGson().toJson(this);
    }

    public static enum TradeStateEnum {
        @SerializedName("SUCCESS")
        SUCCESS,
        @SerializedName("REFUND")
        REFUND,
        @SerializedName("NOTPAY")
        NOTPAY,
        @SerializedName("CLOSED")
        CLOSED,
        @SerializedName("REVOKED")
        REVOKED,
        @SerializedName("USERPAYING")
        USERPAYING,
        @SerializedName("PAYERROR")
        PAYERROR,
        @SerializedName("ACCEPT")
        ACCEPT;
    }

    public static enum TradeTypeEnum {
        @SerializedName("JSAPI")
        JSAPI,
        @SerializedName("NATIVE")
        NATIVE,
        @SerializedName("APP")
        APP,
        @SerializedName("MICROPAY")
        MICROPAY,
        @SerializedName("MWEB")
        MWEB,
        @SerializedName("FACEPAY")
        FACEPAY;
    }
}
